﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VeryExtremeArt.Controller;

namespace VeryExtremeArt
{
    public partial class Register : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            registerSubmit.Click += registerSubmit_Click;
        }

        void registerSubmit_Click(object sender, EventArgs e)
        {
            MemberController mc = new MemberController();
            Member member = new Member();
            member.Email = email.Text;
            member.FirstName = firstName.Text;
            member.LastName = lastName.Text;
            member.Password = password.Text;
            member.Points = 0;
            member.Role = "none";
            member.SubscriptionPaid = false;
            member.UserName = username.Text.Trim();
            try
            {
                mc.RegisterMember(member);
            }
            catch (Exception ex)
            {
                Response.Write("<script>window.alert('" + ex.Message + "')</script>");
            }
        }
    }
}